package AdminController;


import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.springframework.validation.BindException;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.AbstractCommandController;
import org.springframework.web.servlet.view.RedirectView;

import Dao.AdminDao;

public class BoardDelete extends AbstractCommandController {

	private AdminDao dao;
	
	public void setAdminDao(AdminDao dao) {
		this.dao = dao;
	}

	@Override
	protected ModelAndView handle(HttpServletRequest request,
			HttpServletResponse response, Object obj, BindException arg3)
			throws Exception {
		
		
		int nb_no = Integer.parseInt(request.getParameter("nb_no"));
		System.out.println(nb_no);
		
		dao.deleteBoard(nb_no);
		
		ModelAndView mv = new ModelAndView();
		mv.setView(new RedirectView("boardAdmin.admin"));
		
		return mv;
	}

}